package com.eusoft.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

/**
 * @author eusoft
 * @since 2021-10-12
 */

@Configuration
public class GlobalCorsConfig {


    //@Bean
    //public CorsFilter corsFilter() {
    //    CorsConfiguration config = new CorsConfiguration();
    //    config.addAllowedOrigin("*");
    //    config.addAllowedMethod("*");
    //    config.addAllowedHeader("*");
    //    config.addExposedHeader("token");
    //    UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
    //    configSource.registerCorsConfiguration("/**", config);
    //    return new CorsFilter(configSource);
    //}

}
